<!DOCTYPE html>
<html>
	<head>
		<title>记账本</title>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="description" content="Tiny-bookkeeping v1.0.0" />
		<meta name="Author" content="Tiny" />
		<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta name ="apple-mobile-web-app-title"content ="bill">
		<link rel="shortcut icon" type="text/css" href="img/favicon.ico" />
		<link rel="apple-touch-icon-precomposed" href="img/banner3_03.png" />
		<link rel="apple-touch-startup-image" href="start/Startpage@3x.png"  media="screen and (device-width: 414px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@3x.png"  media="screen and (device-width: 736px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/640+960.png" media="screen and (device-width: 320px)  and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/640+960.png" media="screen and  (device-width: 480px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/640_1136.png" media="screen and (device-width: 320px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/640_1136.png" media="screen and (device-width: 568px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@2x.png" media="screen and (device-width: 375px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@2x.png" media="screen and (device-width: 667px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@iPhone X.png" media="screen and (device-width: 375px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@iPhone X.png" media="screen and (device-width: 812px) and (orientation: landscape)" >
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
	</head>
	<style type="text/css">
		body{
			background-image: url(start/Startpage@3x.png);
			height: 100%;
			background-size: 100%;
			padding-bottom: 40px;
		}
		#list {
			/*避免导航边框和列表背景边框重叠，看起来像两条边框似得；*/
			margin-top: -1px;
		}
		.mui-input-row {
			background-color: #ffffff;
		}
		#budget{
			line-height: 40px;
			
		}
		.mui-content{
			opacity: 0.9;
		}
		.tiny-content-1{
			width: 100%;
			display: inline-block;
			overflow: hidden;
		}
		.tiny-content-2{
			width: 100%;
			display: inline-block;
			overflow: hidden;
			/*height: 35px;
			line-height: 40px;*/
		}
		.tiny-content-3{
			display: inline-block;
			overflow: hidden;
		}
		#app{
			font-size: 12px;
		}
	</style>
	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">消费金额 <a class="mui-pull-right"id="main">返回主页</a></h1>
		</header>
		<div class="mui-content">
			<ul class="mui-table-view" id="app">
			    <li class="mui-table-view-cell tiny-content" v-for="(site,index) in sites"> 
			    	<div v-if="index == 0">
			    		<span class="tiny-content-1" >预算：{{ site.budget }}元</span>
				        <span class="tiny-content-2" v-if = "site.detail ==''">消费内容：未填写</span>
				        <span class="tiny-content-2" v-else = "site.detail !=''">标识：{{site.detail}}</span>
				      	<span class="tiny-content-3" >时间：{{site.nowDate}}</span>
			    	</div>
			    	<div  v-if="index > 0">
			    		<span class="tiny-content-1" >消费{{index}}：{{ site.consumption }}元</span>
				        <span class="tiny-content-2" v-if = "site.detail ==''">标识：未填写</span>
				        <span class="tiny-content-2" v-else = "site.detail !=''">标识：{{site.detail}}</span>
				        <span class="tiny-content-3" >时间：{{site.nowDate}}</span>
			    	</div>
			    </li>
			    <li class="mui-table-view-cell" >
			    	消费合计：<span>{{total}}元</span>
			    </li>
			</ul>
		</div>
		<div style="width: 100%;height: 40px;position: fixed;bottom: 0;text-align: center;line-height: 40px;">
			<a style="color: black;" href="tel:1-862-551-8603">联系我：18625518603</a>
			<span> &nbsp;QQ:839435033</span>
		</div>
		<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
		<script>
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			if(localStorage.getItem("Book") == null){
				window.location.href = 'index.html';
			}
			document.getElementById('main').onclick = function(){
				window.location.reload();
				window.location.href = "main.html";
			};
			var Book = JSON.parse(localStorage.getItem('Book'));
			var total = 0;
			for(var i = 1;i<Book.length;i++)
			{
				total = total + parseFloat(Book[i].consumption)
			}
			total = total.toFixed(2);
			new Vue({
			  el: '#app',
			  data: {
			    sites: Book,
			    total:total
			  }
			})
//			console.log(Book);
			var nativeWebview, imm, InputMethodManager;
			var initNativeObjects = function() {
				if(mui.os.android) {
					var main = plus.android.runtimeMainActivity();
					var Context = plus.android.importClass("android.content.Context");
					InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
					imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
				} else {
					nativeWebview = plus.webview.currentWebview().nativeInstanceObject();
				}
			};
			var showSoftInput = function() {
				if(mui.os.android) {
					imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
				} else {
					nativeWebview.plusCallMethod({
						"setKeyboardDisplayRequiresUserAction": false
					});
				}
				setTimeout(function() {
					var inputElem = document.querySelector('input');
					inputElem.focus();
					inputElem.parentNode.classList.add('mui-active'); //第一个是search，加上激活样式
				}, 200);
			};
			mui.plusReady(function() {
				initNativeObjects();
				showSoftInput();
			});
		</script>
	</body>

</html>